/**
 * 
 */
package com.xcn.test;

import java.io.*;




/**
 * @author changmin
 * @since 2013-05-30
 */
public class Sample
{
	protected final static String[] WEEK_NAME_KR = { "일", "월", "화", "수", "목", "금", "토" };
	
	protected static String[] HOUR_NAME_KR = new String[96];
	
	protected static String[] HOUR_NAME_KR2 = new String[24];

	/**
	 *    
	 */
	public Sample( )
	{
		double num = 0.0;
		for ( int i = 0 ; i < HOUR_NAME_KR.length ; i++ )
		{
			num = ((i/2)*30)/60.0;
			String hour = ( int ) num + "시";
			String time = "";
			if ( i%4 == 0 ) time = "00분";
			if ( i%4 == 1 ) time = "29분";
			if ( i%4 == 2 ) time = "30분";
			if ( i%4 == 3 ) time = "59분";
			HOUR_NAME_KR[i] = hour + time;
		}
		
		
		for ( int i = 0 ; i < HOUR_NAME_KR2.length ; i++ )
		{
			HOUR_NAME_KR2[i] = i + "시";
		}
	}
	

	public int[] getIntArray ( String args )
	{
		int[] result = new int[args.length ( )];
		for ( int i = 0 ; i < args.length ( ) ; i++ )
		{
			if ( args.charAt ( i ) == '1' ) result[i] = 1;
			else result[i] = 0;
		}
		return result;
	}
	
	
	public String getContinuityName  ( String weekChecked, String[] nameLang )
	{
		if ( weekChecked == null || weekChecked.length ( ) == 0 ) return "";

		int[] xx = getIntArray ( weekChecked );
		String result = "";
		int maxEnd = 0;
		for ( int i = 0 ; i < xx.length ; i++ )
		{
			if ( xx[i] == 0 ) continue;
			if ( i > 0 && i <= maxEnd ) continue;

			maxEnd = 0;
			for ( int j = i ; j < xx.length ; j++ )
			{
				if ( xx[j] == 0 ) break;
				maxEnd = j;
			}

			if ( i < maxEnd )
				result += nameLang[i] + "~" + nameLang[maxEnd] + ",";
			else
				result += nameLang[i] + ",";
		}
		if ( result.length ( ) > 0 ) result = result.substring ( 0, result.length ( ) - 1 );
		return result;
	}
	
	
	public String doubleString ( String str )
	{
		StringBuffer _sb = new StringBuffer ( );
		for ( int i = 0 ; i < str.length ( ) ; i++ )
		{
			_sb.append ( str.charAt ( i ) ).append ( str.charAt ( i ) );
		}
		return _sb.toString ( );
	}
	
	/**
	 * @param args
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 */
	public static void main ( String[] args ) throws FileNotFoundException, IOException
	{
		System.out.println ( "============>" );
	}
}
